package tt.com.business.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import tt.com.business.service.CremateService;
import tt.com.common.model.Cremate;

import javax.servlet.http.HttpServletRequest;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

@RestController
@RequestMapping(value ="cremate/time")
//火化办理的前端-后端/api/cremate/time/xxxx
public class CremateController {
    @Autowired
    private CremateService cremateService;
    @PostMapping(value = "select/Information")
    public ResponseEntity selectInformation(@RequestParam("date") String date, HttpServletRequest request) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd") ;
        Date dates = sdf.parse(date);
        System.out.println(dates);
        return cremateService.selectInformation(dates);
    }
}
